// 生成一副扑克牌
const cards = [];
const suits = ['♠', '♥', '♣', '♦'];
const ranks = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'];
const jokers = ['小王', '大王'];

for (const suit of suits) {
  for (const rank of ranks) {
    cards.push(rank + suit);
  }
}

cards.push(...jokers);

// 随机洗牌
for (let i = cards.length - 1; i > 0; i--) {
  const j = Math.floor(Math.random() * (i + 1));
  [cards[i], cards[j]] = [cards[j], cards[i]];
}
// 发牌
const players = [[], [], []]; // 三个玩家
for (let i = 0; i < 51; i++) {
  players[i % 3].push(cards[i]);
}
// 输出每个玩家的牌
for (let i = 0; i < players.length; i++) {
  console.log(`玩家${i + 1}的牌为：${players[i].join(', ')}`);
}
console.log("底牌 : "+cards.slice(51));